package com.ziroom.crm.mq.core.support

import com.ziroom.crm.mq.core.BaseSpecification
import com.ziroom.crm.mq.core.MqType
import com.ziroom.crm.mq.core.context.InvokeContext
import com.ziroom.crm.mq.core.data.Message
import com.ziroom.crm.mq.core.node.StatisticNode
import com.ziroom.crm.mq.core.processor.QueueWrapper

import java.time.LocalDateTime
import java.util.function.Consumer

class SimpleProcessorInvokerDelegateTest extends BaseSpecification {
    ProcessorInvokerDelegate processorInvokerDelegate = new SimpleProcessorInvokerDelegate()

    private InvokeContext invokerContent
    private QueueWrapper queueWrapper
    private Message message


    def setup() {
        message = new Message(UUID.randomUUID().toString(), "message body")
        message.setException(new BindException("i am exception"))
        def node = new StatisticNode()
        invokerContent = new InvokeContext(message, node)
        def callback = { println(LocalDateTime.now().toString()+":重试方法回调：打印：" + it) } as Consumer
        queueWrapper = new QueueWrapper("my.queue.name", MqType.RABBIT, callback)
    }

    def testPreSendInvoke() {
    }

    def testPostSendInvoke() {
    }

    def testPreReSendInvoke() {
    }

    def testPostReSendInvoke() {
    }

    def testPreConsumeInvoke() {
    }

    def testPostConsumeInvoke() {
        processorInvokerDelegate.postConsumeInvoke(queueWrapper,message)
        expect:
            1==1
    }

    def testPreReConsumeInvoke() {
    }

    def testPostReConsumeInvoke() {
    }
}
